package com.github.slprj.slake.log;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Des:
 * slf4j日志工厂
 *
 * @author captain
 * @date 2022/8/19 18:02
 */
public class Slf4jFactory implements SlLogFactory {

    public static boolean isSlf4jExist() {
        try {
            Class.forName("org.slf4j.Logger");
            return true;
        } catch (ClassNotFoundException e) {
            return false;
        }
    }

    @Override
    public SlLog getLogger(String name) {
        Logger logger = LoggerFactory.getLogger(name);
        return new Slf4jLog(logger);
    }

    @Override
    public SlLog getLogger(Class<?> clazz) {
        Logger logger = LoggerFactory.getLogger(clazz);
        return new Slf4jLog(logger);
    }
}
